#include <iostream>
#include <vector>
#include <algorithm>
#define endl '\n'
#define int long long
#define pii pair<int, int>
using namespace std;

// 已知
int n, m;
// 未知

int x = 1;
int sum = 1;

signed main()
{
    cin >> n >> m;
    for (int i = 0; i < m; ++i)
    {
        x *= n;
        sum += x;
        if (sum > 1e9)
        {
            cout << "inf";
            return 0;
        }
    }
    cout << sum;
    return 0;
}